﻿using Newtonsoft.Json.Linq;
using System;

namespace XbmcManager.Types
{
    public class XbmcEpisode
    {

        #region Properties
        private static string TITLE = "title";
        private static string SEASON = "season";
        private static string EPISODE = "episode";
        private static string SHOWTITLE = "showtitle";
        private static string PLAYCOUNT = "playcount";
        private static string TVSHOWID = "tvshowid";
        private static string FILE = "file";
        private static string LABEL = "label";

        public string title { get; set; }
        public int Season { get; set;}
        public int Episode { get; set; }
        public String ShowTitle { get; set; }
        public int PlayCount { get; set; }
        public int TvShowId { get; set; }
        public String File { get; set; }
        public String EpisodeTitle { get; set; }
        public readonly static string[] FIELDS = {
                                                     TITLE
                                                     ,SEASON
                                                     ,EPISODE
                                                     ,SHOWTITLE
                                                     ,PLAYCOUNT
                                                     ,TVSHOWID
                                                     ,FILE};
        #endregion

        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="episode"></param>
        public XbmcEpisode(JObject episode)
        {
            this.title = (String)episode[TITLE];
            this.Season = (int)episode[SEASON];
            this.Episode = (int)episode[EPISODE];
            this.ShowTitle = (String)episode[SHOWTITLE];
            this.PlayCount = (int)episode[PLAYCOUNT];
            this.TvShowId = (int)episode[TVSHOWID];
            this.File = (String)episode[FILE];
            this.EpisodeTitle = (String)episode[LABEL];
        }
    }
}
